<template>
  <div class="loginContainer">
    <!-- 头部 -->
    <div class="header">
      <!-- 用户信息 -->
      <div class="login">
        <div class="myUser">
          <div class="userLeft">
            <img class="avatar" src="../../assets/imgs/avatar.png" alt="" />
            <div class="userInfo">
              <p class="userName">{{userName}}</p>
              <div class="userLevel">普通用户</div>
            </div>
          </div>
          <div class="userRight">
            <img class="qrCode" src="" />
            <div class="superEntrance"></div>
          </div>
        </div>
      </div>
      <!-- 资产部分 -->
      <div class="assets">
        <div class="assetsTop">
          <div class="assetsName">
            <div class="littleName">我的资产</div>
          </div>
        </div>
        <div class="assetsBottom">
          <div class="assetsBox">
            <p class="assetsCount">￥0</p>
            <p class="assetsName">余额</p>
          </div>
          <div class="assetsBox">
            <p class="assetsCount">￥0</p>
            <p class="assetsName">余额</p>
          </div>
          <div class="assetsBox">
            <p class="assetsCount">￥0</p>
            <p class="assetsName">余额</p>
          </div>
          <div class="assetsBox">
            <p class="assetsCount">￥0</p>
            <p class="assetsName">余额</p>
          </div>
          <div class="assetsBox">
            <p class="assetsCount">￥0</p>
            <p class="assetsName">余额</p>
          </div>
        </div>
      </div>
    </div>
    <!-- 菜单 -->
    <div class="menu">
      <div class="welfare">
        <img src="../../assets/imgs/fare.webp" class="fareImg">
      </div>
      <van-grid :column-num="3" class="bigGrid">
        <van-grid-item icon="orders-o" text="我的订单" />
        <van-grid-item icon="user-circle-o" text="账号管理" />
        <van-grid-item icon="phone-o" text="我的手机号" />
        <van-grid-item icon="calendar-o" text="周六一起拼" />
        <van-grid-item icon="cash-back-record" text="售后服务" />
        <van-grid-item icon="envelop-o" text="邀请返利" />
        <van-grid-item icon="bag-o" text="优先购" />
        <van-grid-item icon="gold-coin-o" text="积分中心" />
        <van-grid-item icon="diamond-o" text="会员俱乐部" />
        <van-grid-item icon="location-o" text="地址管理" />
        <van-grid-item icon="certificate" text="支付安全" />
        <van-grid-item icon="service-o" text="帮助与客服" />
        <van-grid-item icon="comment-circle-o" text="意见反馈" />
        <van-grid-item icon="points" text="我的竞拍" />
        <van-grid-item text="" />
      </van-grid>
    </div>
    <!-- 退出登录 -->
    <div class="logout" @click="logonOut">退出登录</div>
    <tabBarVue />
  </div>
</template>

<script lang="ts">
export default {
  name: 'center'
};
</script>
<script lang="ts" setup>
import { onMounted, reactive, ref } from 'vue';
import { useRouter } from 'vue-router';
import { Dialog } from 'vant';
import { useUserInfoStore } from '../../store/user';
import { getLogout } from '../../api/api2/login';

const userInfoStore = useUserInfoStore();
const router = useRouter();
const userName = ref();
// console.log(userInfoStore.name);
userName.value = userInfoStore.name;
const logonOut = () => {
  Dialog.confirm({
    title: '退出登录',
    message: '您是否确认退出登录？'
  })
    .then(async () => {
      userInfoStore.getLogoutAsync();
      router.push('/login');
    })
    .catch(() => {});
};
</script>

<style lang="less" scoped>
.loginContainer {
  height: 100%;
  background-color: #eeeeee;
  .header {
    height: 268px;
    width: 100%;
    margin-bottom: 10px;
    .login {
      height: 135px;
      width: 100%;
      background: url('../../assets/imgs/headerback.png');
      .myUser {
        width: 360px;
        margin-left: 15px;
        display: flex;
        justify-content: space-between;
        .userLeft {
          width: 241px;
          height: 71px;
          display: flex;
          margin: 32px 0;
          .avatar {
            width: 71px;
            height: 71px;
            border-radius: 50%;
          }
          .userInfo {
            display: flex;
            margin-left: 15px;
            flex-direction: column;
            .userName {
              font-size: 18px;
              color: #fff;
              margin-top: 10px;
              margin-bottom: 5px;
            }
            .userLevel {
              font-size: 14px;
              color: #fff;
            }
          }
        }
        .userRight {
          width: 120px;
          height: 94px;
          display: flex;
          align-items: center;
          flex-direction: column;
          margin: auto 0 0 9px;
        }
        .qrCode {
          width: 32px;
          height: 32px;
          margin-right: -10px;
        }
        .superEntrance {
          width: 111px;
          height: 42px;
          border-radius: 21px 0 0 21px;
          background-color: #4e463d;
        }
      }
    }
    .assets {
      height: 133px;
      width: 100%;
      background-color: #fff;
      .assetsTop {
        height: 53px;
        line-height: 53px;
        font-size: 14px;
        .littleName {
          width: 360px;
          margin-left: 15px;
          border-bottom: 1px solid #eee;
        }
      }
      .assetsBottom {
        display: flex;
        height: 80px;
        .assetsBox {
          display: flex;
          width: 70px;
          text-align: center;
          margin: auto;
          flex-direction: column;
          .assetsCount {
            font-size: 16px;
            font-weight: 700;
            margin-bottom: 2px;
          }
          .assetsName {
            font-size: 12px;
            margin-top: 0;
            font-weight: 400;
          }
        }
      }
    }
  }
  .menu {
    height: 523px;
    width: 100%;
    // background-color: pink;
    margin: 10px auto;
    .welfare {
      height: 69px;
      display: flex;
      background-color: #fff;
      .fareImg {
        height: 48px;
        width: 345px;
        margin: auto;
      }
    }
    .bigGrid {
      height: 450px;
    }
  }
  .logout {
    height: 48px;
    line-height: 48px;
    width: 100%;
    font-size: 14px;
    text-align: center;
    margin: 10px auto;
    background-color: #fff;
  }
}
</style>
